#include <stdio.h>
#include <string.h>
#define MAX 105

double map[MAX][MAX];
int n,m;

void init()
{
	int i,j,a,b,c;
	double va;
	memset(map,0,sizeof(map));
	for (i=1;i<=m;i++)
	{
		scanf("%d%d%d", &a, &b, &c);
		va=c*1.0/100;
		map[a][b]=map[b][a]=va;
	}

}

void flody()
{
	int i,j,k;
	for (k=1;k<=n;k++)
		for (i=1;i<=n;i++)
			for (j=1;j<=n;j++)
				if (i!=j && (map[i][k]*map[k][j]>map[i][j]))
				{
					map[i][j]=map[i][k]*map[k][j];
				}
}

main()
{
	while (1)
	{
		scanf("%d", &n);
		if (n==0) break;
		scanf("%d", &m);
		init();
		flody();
		printf("%.6lf percent\n", map[1][n]*100);
	}
	return 0;
}
